package com.security.dataprocess.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.security.dataprocess.bean.VideoAnPointBean;
import com.security.dataprocess.mapper.DeviceTVideoDraftMapper;
import com.security.dataprocess.model.DeviceTVideoDraft;
import com.security.dataprocess.service.IDeviceTVideoDraftService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 摄像头草稿表 服务实现类
 * </p>
 *
 * @author H
 * @since 2022-12-19
 */
@Service
@DS("mysql3")
public class DeviceTVideoDraftServiceImpl extends ServiceImpl<DeviceTVideoDraftMapper, DeviceTVideoDraft> implements IDeviceTVideoDraftService {

    @Override
    public  IPage<DeviceTVideoDraft> findListByPage(Integer page, Integer pageCount){
        IPage<DeviceTVideoDraft> wherePage = new Page<>(page, pageCount);
        DeviceTVideoDraft where = new DeviceTVideoDraft();

        return   baseMapper.selectPage(wherePage, Wrappers.query(where));
    }

    @Override
    public int add(DeviceTVideoDraft deviceTVideoDraft){
        return baseMapper.insert(deviceTVideoDraft);
    }

    @Override
    public int delete(Long id){
        return baseMapper.deleteById(id);
    }

    @Override
    public int updateData(DeviceTVideoDraft deviceTVideoDraft){
        return baseMapper.updateById(deviceTVideoDraft);
    }

    @Override
    public DeviceTVideoDraft findById(Long id){
        return  baseMapper.selectById(id);
    }

    @Override
    public long getIdMax() {
        return  baseMapper.getIdMax();
    }

    @Override
    public List<VideoAnPointBean> listAnPoint() {
        return baseMapper.listAnPoint();
    }
}
